#ifndef __WIN_MUTEX_H__
#define __WIN_MUTEX_H__

#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif

#include <windows.h>

#include "../non_copyable.h"


namespace Boss
{

  namespace Internal
  {

    class MutexImpl
      : private NonCopyable
    {
    public:
      MutexImpl()
      {
        InitializeCriticalSection(&Section);
      }
      ~MutexImpl()
      {
        DeleteCriticalSection(&Section);
      }
      void Lock()
      {
        EnterCriticalSection(&Section);
      }
      void UnLock()
      {
        LeaveCriticalSection(&Section);
      }

    private:
      CRITICAL_SECTION Section;
    };

  }

  typedef Internal::MutexImpl Mutex;

}

#endif  // !__WIN_MUTEX_H__
